package com.gylang.im.user.dto;


import com.gylang.commons.dto.BaseDTO;
import com.gylang.commons.valid.Group1;
import com.gylang.commons.valid.Group2;
import com.gylang.commons.valid.Group3;
import com.gylang.commons.valid.NotNullAndPattern;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;

/**
 * 用户 Group1 手动校验规则
 *
 * @author gylang
 * data 2020/9/3
 * @version v0.0.1
 */
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PtUserDTO extends BaseDTO {


    @Size(min = 6, max = 32, message = "账户格式不对，不能小于6大于32", groups = Group1.class)
    @NotEmpty(message = "用户名不能为空", groups = Group1.class)
    private String username;

    @NotEmpty(message = "邮箱不能为空", groups = Group2.class)
    @Email(message = "邮箱格式不正确", groups = Group2.class)
    private String email;

    @NotNullAndPattern(regexp = "RegexConstant.TEL", message = "手机号码格式不正确", groups = Group3.class)
    private String tel;

    @NotEmpty(message = "密码不能为空")
    private String password;

}
